#include "ThreadPool.hpp"
#include <memory>
#include <unistd.h>


int main()
{
    unique_ptr<ThreadPool<Task>> tp(new ThreadPool<Task>());
    tp->run();      //线程先跑起来，等待任务的到来

    int x,y;
    char op;
    while(true)
    {
        cout<< "请输入你要计算的内容"<< endl;
        cout<< "格式如下：x+y" << endl<<">:";
        cin >> x >> op >> y;
        Task t(x,y,op,mymath);  //  创建任务
        tp->push(t);            //  插入任务

        sleep(1);
        cout<< "---------------------------------------"<<endl;
    }
    return 0;
}

// 监控脚本指令->循环查看存在的线程
//while :; do ps -aL | grep Threadpool; sleep 1;echo "##################"; done